// src.controllers.mobileh5.controller.js

var services = require('../services/index');
var jsonUtil = require('../helper/JsonUtil');
var log = require('log4js').getLogger('mobileh5.controller');

exports.save = function(req, res, next) {
    var _id = req.body._id;
    if(_id) req.query._id = _id;
    services.mobileh5Save(req, res, function(err, result){
        if(err){
            log.debug(err);
        }
        jsonUtil.jsonWrite(res, result);
    });
};

exports.delete = function(req, res, next) {
    services.mobileh5Delete(req, res, function(err, result){
        if(err){
            log.debug(err);
        }
        jsonUtil.jsonWrite(res, result);
    });
};

exports.queryById = function(req, res, next) {
    services.mobileh5QueryById(req, res, function(err, result){
        if(err){
            log.debug(err);
        }
        jsonUtil.jsonWrite(res, result);
    });
};

exports.queryByPage = function(req, res, next) {
    services.mobileh5QueryByPage(req, res, function(err, result){
        if(err){
            log.debug(err);
        }
        jsonUtil.jsonWrite(res, result);
    });
};

exports.queryAllByPage = function(req, res, next) {
    services.mobileh5QueryByPage(req, res, function(err, result){
        if(err){
            log.debug(err);
        }
        jsonUtil.jsonWrite(res, result);
    });
};